define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            $(document).on('click', '.btn-save', function () {
                Fast.api.ajax({
                    url: 'ranking/index',
                    data: {type:$('input[name=type]:checked').val()}
                });
            });

            $(document).on('click', '.btn-preview', function () {
                Fast.api.ajax({
                    url: 'ranking/index',
                    data: {type:$('input[name=type]:checked').val()},
                    success:function () {
                        layer.closeAll();
                        window.open('/admin/ranking/show', '_blank');
                    }
                });
            });
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
